package com.tl.share.share;

import android.content.Context;
import android.text.TextUtils;

import com.mob.MobSDK;
import com.tl.share.R;

/**
 * Created by Administrator on 2017/6/29.
 */

public class ShareUtils {

    public static void showDefault(Context context){
        show(context,null);
    }


    public static void show(Context context, ShareBean shareBean){
        if (context==null){
            return;
        }
        MobSDK.init(context,"1ef269ef4a438","5522980b00a717d1e5a3156115156620");
        OnekeyShare oneoks=new OnekeyShare();
        oneoks.disableSSOWhenAuthorize();

        if (shareBean==null||TextUtils.isEmpty(shareBean.getImageurl())){

        oneoks.setImageUrl(context.getString(R.string.shareImage));
        }else {
            oneoks.setImageUrl(shareBean.getImageurl());
        }
        if (shareBean==null||TextUtils.isEmpty(shareBean.getTitle())){


            oneoks.setTitle(context.getString(R.string.app_name));
        }else {
            oneoks.setTitle(shareBean.getTitle());
        }

        if (shareBean==null||TextUtils.isEmpty(shareBean.getContent())){
         oneoks.setText(context.getString(R.string.shareText));
        }else {
            oneoks.setText(shareBean.getContent());
        }
        if (shareBean==null||TextUtils.isEmpty(shareBean.getUrl())){

            oneoks.setUrl(context.getString(R.string.shareUrl));
        }else {
            oneoks.setUrl(shareBean.getUrl());
        }
        oneoks.show(context);

    }


}
